package service

import (
	"context"
	"home-butler/internal/model"
)

type (
	IProduct interface {
		ProductList(ctx context.Context, req *model.ProductReq) (total int, res []*model.ProductRes, err error)
		CreateProduct(ctx context.Context, req *model.ProductCreateReq) (res *model.ProductRes, err error)
		ProductAddMetadata(ctx context.Context, req *model.ProductAddMetadataReq) (res *model.ProductRes, err error)
		FindGetMetadata(ctx context.Context, id uint64) (key string, deviceType string, res *model.ProductMetadataModel, err error)
		ReleasedProduct(ctx context.Context, req *model.ReleasedProductReq) (err error)
		UpdateProduct(ctx context.Context, req *model.ProductUpdateReq) (res *model.ProductRes, err error)
		DelProduct(ctx context.Context, req *model.ProductDeleteReq) (res *model.ProductRes, err error)
	}
)

var (
	localProduct IProduct
)

func Product() IProduct {
	if localProduct == nil {
		panic("implement not found for interface IProduct, forgot register?")
	}
	return localProduct
}

func RegisterProduct(i IProduct) {
	localProduct = i
}
